Slot machine: a Jlerts custom widget
====================================

A slot machine your viewers play with their loyalty points. They type !slots 50 in chat: the lever pulls, the three
reels spin and stop one by one with a clunk, and the screen shows the result. Wins ring a bell and pay out; three the
same is a JACKPOT with a fanfare and a shower of coins. Plays take turns, so several people at once wait in line.

Add it to Jlerts
1. Unzip this folder somewhere it can stay (for example Documents\Jlerts widgets\Slot machine).
2. In Jlerts: Widgets -> + New widget -> Custom widget (HTML / CSS / JS).
3. Widget folder -> Choose folder... and pick this folder. Its settings appear underneath.
4. Under Loyalty points in its settings, tick "Allow this widget to change points" and set "The most it can give or
   take per viewer" high, e.g. 1000000 (it counts every win and loss since Jlerts started, so 500 runs out fast).
5. Leave the widget's own Command box (near the top) empty: the slot machine listens for its command itself.
6. Drag it onto your overlay (520 x 640). To change its size, drag the edges of its box on the canvas.

Loyalty points need to be on (Community Hub -> Points). If you also use Jlerts' built-in !slots game (Community Hub ->
Games & shop), switch that off or give this machine a different command, or both will answer.

Playing
- !slots 50      bet 50 (also !slots all, !slots half)
- !slots test    you and your mods: a practice spin with no points, handy while setting it up
- Who can play, the smallest and biggest bet and the wait between turns are in its settings.
- The points change the moment someone plays; the machine then shows it when their turn comes.
- Too many waiting (10 by default): extra plays are told to try again in a moment, and nothing is taken.
- Replies in chat: tick "Allow this widget to write in chat" (under Chat in its settings) and the machine answers each
  play in chat as its reels land, e.g. "@Ann_Birch [ 🍒 🍒 🍋 ] won 750 Gems! You have 1,250." (so chat never gives the
  result away). Messages like "you only have 50 points" go to chat too, and always show under the machine. Change the
  replies with Win reply / Lose reply ({user} {reels} {payout} {bet} {total} {points_name}), or untick Reply in chat.
  Needs the latest Jlerts.

The Vault (Jlerts' jackpot)
- Three treasure chests win the Vault: Jlerts' jackpot pot (Community Hub -> Games & shop -> The Vault), which a share
  of every loss goes into. It's extremely hard to win: Jlerts rolls the dice with your odds (1 in 50,000 to start
  with), never the machine. One or two chests can come up any time (two pay like any pair); three only for the Vault.
- The machine shows "VAULT 48,250" at the top while the Vault is on (untick "Show the Vault" to hide it and stop trying
  for it). Tick "Allow this widget to try for the Vault" in the widget's settings for chests to win it.
- Each play takes the whole bet first (so it counts for the Vault), then pays any win. Both count towards the most it
  can give or take per viewer, so set that high (see step 4).
- When someone wins, Jlerts pays it and says so in chat as their reels land.

What it pays (times the bet)
  💰 💰 💰        THE VAULT
  7 7 7            100x
  diamonds          40x
  stars             20x
  BAR BAR BAR       15x
  bells             10x
  lemons             4x
  cherries           3x
  any two the same 1.5x

Win rate
- "Win rate" in its settings is how often a spin wins something (45% by default). The machine decides win or lose
  first, then the reels fall as usual, so jackpots stay rare.
- On average a spin gives back about 1.8 x the win rate: 45% gives back about 81 of every 100 bet, 55% about all of it,
  and more than that hands out points.

Sounds
- In the sounds folder: lever, reel (loops while they spin), stop, win, jackpot, lose. Swap any for your own .wav with
  the same name. make-sounds.py made them (python make-sounds.py makes them again).
- Sounds and Volume are in its settings.

Only have it on one overlay at a time: two open copies would both take the bet.
